<template>
    <el-dialog
  title="订单图书"
  :visible.sync="dialogVisible"
  width="60%"
  :before-close="handleClose">
 <ul v-for="(item, i) in navList" :key="i" >
      <li>{{ item }}</li>
      <el-button type="primary" plain @click="del(item)">退货</el-button>
 </ul>
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  </span>
</el-dialog>
</template>
<script>
export default {
    name: 'Order',
    data() {
      return {
          dialogVisible: false,
          navList: [
               
            
               ],
      };
    },
    mounted: function () {
        this.getbooks()
    },
    methods: {
      // handleClose(done) {
      //   this.$confirm('确认关闭？')
      //     .then(_ => {
      //       done();
      //     })
      //     .catch(_ => {});
      //   },
        getbooks() {
            this.$axios.get("/getbooks").then((resp) => {
                this.navList = resp.data;
            });
        },
        del(item) {
            var data = new FormData()
            data.append("delbook",item)
            this.$axios.post('/delorder', data).then(resp => {
                if (resp.data.code === 200) {
                    this.$message({
                        message: '退货成功',
                        type: 'success'
                    })
                     this.getbooks()
                }
               
            })
           
        }
    },
    
}
</script>
<style scoped>
li{
    display: inline;
}
</style>